use mini_redis::{client, Result};

/// #[tokio::main] 会转换下面的main函数
/// 例如：
/// #[tokio::main]
/// async fn main() {
///     println!("hello");
/// }
/// 转换为
/// fn main() {
///     let mut rt = tokio::runtime::Runtime::new().unwrap();
///     rt.block_on(async {
///         println!("hello");
///     })
/// }
#[tokio::main]
async fn main() -> Result<()> {
    let mut client = client::connect("127.0.0.1:6379").await?;
    client.set("hello", "world".into()).await?;
    let result = client.get("hello").await?;
    println!("got value from the server; result={:?}", result.unwrap());
    Ok(())
}
